<style tyle="text/css">
  .modal-lg {
      width: 60%;
  }
  .red {
    color: #f00
  }
</style>
<div class="modal-header">
  <h4 class="modal-title">{{activity.title}}</h4>
</div>
<div class="modal-body">
  <div class="panel-body">
    <div class="col-lg-6">
      <div class="input-group" >
        <div class="input-group-btn">
          <span class="btn btn-default">机构名称</span>
        </div>
        <ui-select ng-model="formData.company" theme="bootstrap">
          <ui-select-match placeholder="选择..">{{$select.selected.name}}</ui-select-match>
          <ui-select-choices repeat="item in company_list | filter: $select.search | filter: {'show': true}">
            <span ng-bind-html="item.name | highlight: $select.search"></span>
          </ui-select-choices>
        </ui-select>
      </div>
    </div>
    <div class="col-lg-4">
      <div class="input-group">
        <input type="number" class="form-control" ng-model="formData.num" placeholder="分配名额">
        <span class="input-group-addon">人</span>
      </div>
    </div>
    <div class="col-lg-6 mt10">
      <div class="input-group" >
        <div class="input-group-btn">
          <span class="btn btn-default">默认乘车地址</span>
        </div>
        <ui-select ng-model="formData.address_id" theme="bootstrap">
          <ui-select-match placeholder="选择.." style="width: 234px">
            {{$select.selected.address}}（{{'上车时间' + $select.selected.start_time}}）
          </ui-select-match>
          <ui-select-choices repeat="item.id as item in adress_list | filter: $select.search">
            <span>{{item.address}}（{{'上车时间' + item.start_time}}）</span>
          </ui-select-choices>
        </ui-select>
      </div>
    </div>
    <div class="col-lg-3 mt10" style="line-height: 34px;">
      <label class="i-checks m-b-none">
        <input type="checkbox" ng-model="formData.is_address" ng-true-value="'1'" ng-false-value="'0'"><i></i>
      </label>
      <span style="vertical-align: middle;">是否指定乘车地址</span>
    </div>
    <div class="col-lg-2 pull-right mt10">
      <button class="btn btn-success btn-block" ng-click="add()">添加</button>
    </div>
  </div>
  

  <table class="table table-striped table-bordered">
    <thead>
      <tr>
        <th style="width: 15%; text-align: center">机构信息</th>
        <th style="width: 10%; text-align: center">出游日期</th>
        <th style="width: 10%; text-align: center">名额</th>
        <th style="width: 10%; text-align: center">剩余名额</th>
        <th style="width: 10%; text-align: center">指定乘车</th>
        <th style="width: 15%; text-align: center">默认乘车地址</th>
        <th style="width: 10%; text-align: center"></th>
      </tr>
    </thead>
    <tbody>
      <tr ng-repeat="info in list" style="height: 51px">
        <td style="vertical-align: middle;">{{info.company_name}}<br/>{{info.company_code}}</td>
        <td class="text-center" style="vertical-align: middle;">{{info.tour_date}}</td>
        <td class="text-center" style="vertical-align: middle;">
          <span ng-show="!info.update">{{info.all_stock}}</span>
          <input type="number" ng-show="info.update" class="form-control" ng-model="info.all_stock">
        </td>
        <td class="text-center" style="vertical-align: middle;">{{info.surplus_stock}}</td>
        <td class="text-center" style="vertical-align: middle;">{{info.is_address=='1'?'是':'否'}}</td>
        <td style="vertical-align: middle;">{{info.address || '无'}}</td>
        <td class="text-center" style="vertical-align: middle;">
          <button type="button" class="btn btn-info btn-xs" ng-show="!info.update" ng-click="update(info)">编辑</button>
          <button type="button" class="btn btn-success btn-xs" ng-show="info.update" ng-click="save(info)">保存</button>
          <button type="button" class="btn btn-danger btn-xs" ng-click="delete(info, $index)">删除</button>
        </td>
      </tr>
    </tbody>
  </table>

  
</div>
<div class="modal-footer">
  <i class="pull-left red">温馨提示：指定乘车地址后，当前机构只能在默认地址乘车；不指定乘车地址，则可以选择其他乘车地址。</i>
  <button class="btn btn-danger" type="button" ng-click="close()">关闭</button>
</div>